package main

import "fmt"

type Pay struct{}

func (p *Pay) DoPay() {
	fmt.Println("支付成功")
}

type Stock struct{}

func (s *Stock) DeStock() {
	fmt.Println("库存扣减")
}

type Logistic struct{}

func (l *Logistic) Dispatch() {
	fmt.Println("物流配送")
}

type Facade struct {
	pay      *Pay
	stock    *Stock
	logistic *Logistic
}

func (f *Facade) Trade() {
	f.pay.DoPay()
	f.stock.DeStock()
	f.logistic.Dispatch()
}

func NewFacade() *Facade {
	return &Facade{
		pay:      &Pay{},
		stock:    &Stock{},
		logistic: &Logistic{},
	}
}

func main() {
	facade := NewFacade()
	facade.Trade()
}
